let app = getApp();
import { getScenicSpot } from "../../request/api";
Component({
    /**
     * 组件的属性列表
     */
    properties: {

    },

    /**
     * 组件的初始数据
     */
    data: {
        pageNo: 1,
        post_list: []
    },

    /**
     * 组件的方法列表
     */
    methods: {
        // 获取数据
        getPost() {
            let status = 1
            let pageNo = this.data.pageNo
            let data = { status, pageNo }
            getScenicSpot(res => {
                if (res.statusCode == 200) {
                    this.setData({ post_list: this.data.post_list.concat(res.data.data), totalPage: res.data.totalPage })
                }
            }, data);
        },

        // 往详细页面
        onClickDetailed(item) {
            let itemId = item.currentTarget.dataset.item.id
            wx.navigateTo({
                url: '/pages/detail/scenicSpot/scenicSpot?itemId=' + itemId
            });
        }
    },

    lifetimes: {
        attached: function () {
            this.setData({ lang: app.globalData.lang, navTitle: "infCircle", navigation: true })
        },
        ready(){
            this.getPost()
        },
    }
})
